//  Connects to an IRC server you specify and idles. Basically this is a frame for an IRC bot. 

import os
import re
import socket
 
os.fork()
 
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(('irc.kingskrown.com', 6667))
 
s.send('NICK %s \r\n' % 'py')
s.send('USER %s \'\' \'\' :%s\r\n' % ('svs', 'python'))
s.send('JOIN %s \r\n' % '#illuminati')
 
while 1:
   buffer = s.recv(512)
 
   if not buffer:
      break
 
   regex = re.match('(?i)^PING (:[^ ]+)$', buffer)
 
   if regex is not None:
      s.send('PONG %s\r\n' % regex.group(1))
      continue
 
s.close()

